-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XPU] add bfloat16 support for gaussian and uniform #58662
[XPU] add bfloat16 support for gaussian and uniform #58662
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
using XPUType = typename XPUTypeTrait<T>::Type; | ||
int64_t real_seed = seed != 0 ? seed : dev_ctx.GetGenerator()->Random64(); | ||
|
||
// int random(Context* ctx, T* x, int64_t len, T min, T max, int64_t seed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpu的分支是否需要保留?
一个需求是用相同的初始化seed,然后xpu/cpu对比输出,xpu::random的结果和cpu能对齐?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种场景下面用export XPU_BLACK_LIST="uniform_random,gaussian_random"
的办法解决?
目前gaussian_random
也没有保留“从CPU拷贝”的功能。
* [XPU] add bfloat16 support for gaussian and uniform * fix zero dim.
* [XPU] add bfloat16 support for gaussian and uniform * fix zero dim.
* [XPU] add bfloat16 support for gaussian and uniform * fix zero dim.
PR types
New features
PR changes
OPs
Description
给XPU下的
gaussian
和uniform
算子增加bfloat16的类型支持。此外,在之前的
UniformKernel
中,没有使用XDNN提供的API,原因未知。本PR把它的实现改成了直接调用XDNN提供的random
函数。